package com.example.work.util;

import java.util.HashSet;
import java.util.Set;

/**
 * @Description:
 * @author: JinMu
 * @create: 2018-07-27 09:55
 * @Version: 1.0
 **/
public class CheckQQ {

    public static boolean check(String qq) {
        boolean flag = true;
        // 校验长度
        if (qq.length() >= 5 && qq.length() <= 15) {
             // 0不能开头
            if (!qq.startsWith("0")) {
                // 必须是数字
                char[] chs = qq.toCharArray();
                for (int x = 0; x < chs.length; x++) {
                    char ch = chs[x];
                    if (!Character.isDigit(ch)) {
                        flag = false;
                        break;
                    }
                }
            } else {
                flag = false;
            }
        } else {
            flag = false;
        }
        return flag;
    }
    public static boolean checkRepeat(String[] array){
        Set<String> set = new HashSet<String>();
        for(String str : array){
            set.add(str);
        }
        if(set.size() != array.length){
            return false;//有重复
        }else{
            return true;//不重复
        }
    }
}



